package com.ruoyi.system.config;

import com.qiniu.storage.Region;
import com.qiniu.util.Auth;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

;

@Configuration
public class QiniuConfig {

    @Value("XPcUKMPjMlGmyO_MSVtOln4AyVWE6yY5yd9fCxrZ")
    private String accessKey;

    @Value("pkpfE4wgRotDJ0rpg8GpakeNAwW_GVCXnxcMH-Ij")
    private String secretKey;

    @Value("shanhai-sjj")
    private String bucket;

    @Value("sue4dyyzp.hb-bkt.clouddn.com")
    private String domain;

    @Bean(name = "customQiniuConfig")
    public Auth auth() {
        return Auth.create(accessKey, secretKey);
    }

    @Bean(name = "customQiniuStorageConfig")
    public com.qiniu.storage.Configuration qiniuConfig() {
        // 显式声明完整包路径避免类名冲突
        return new com.qiniu.storage.Configuration(Region.autoRegion());
    }


    public String getBucket() {
        return bucket;
    }

    public String getDomain() {
        return domain;
    }
}
